#include <stdio.h>
#include "functions.h"


extern int score[];
int num[10][7]={{1,1,1,1,1,1,0},
                {0,1,1,0,0,0,0},
                {1,1,0,1,1,0,1},
                {1,1,1,1,0,0,1},
                {0,1,1,0,0,1,1},
                {1,0,1,1,0,1,1},
                {1,0,1,1,1,1,1},
                {1,1,1,0,0,0,0},
                {1,1,1,1,1,1,1},
                {1,1,1,1,0,1,1}};

void score_st(int score[])
{
    extern int who_win;
    if(who_win==0)
    {
        score[0]++; 
    }
    if(who_win==1)
    {
        score[1]++;
    }
    
}

void print_d_num(int score[])
{
    int p1 = score[0],p2= score[1];
    int units_digit1,tens_digit1,units_digit2,tens_digit2;
    units_digit1=p1%10;
        print_num(6, HEIGHT , units_digit1);
    tens_digit1=p1/10;
        print_num(0,HEIGHT, tens_digit1);

    units_digit2=p2%10;
        print_num(WIDTH-5,HEIGHT,units_digit2);
    tens_digit2=p2/10;
        print_num(WIDTH-11,HEIGHT,tens_digit2);
}

void print_num (int x, int y, int n)
{

   
   
       //clear 
       for (int i = 0; i < 5; i++)
       {
           gotoxy(x,y+4+i);
           printf("     ");
       }
       //printout
       gotoxy(x,y+4);
       if(num[n][0]) 
       {
            printf(" ---");
            gotoxy(x,y+5);
       }
        else {
            printf(" ");
            gotoxy(x,y+5);
        }
        if(num[n][5]) { 
            printf("|   ");
            }
      
        else {
            printf("    ");
            }
        
       if(num[n][1]) {
            printf("|");
            gotoxy(x,y+6);
       }
        else 
        {
            printf("   ");
            gotoxy(x,y+6);
            }
       if(num[n][6]) {
            printf(" ---");
            gotoxy(x,y+7);
            }
        else {
            printf(" ");
            gotoxy(x,y+7);
            }
       if(num[n][4]){
            printf("|   ");
       } 
        else {printf("    ");}
       if(num[n][2]) {
            printf("|");
            gotoxy(x,y+8);
           }
        else {
            printf(" ");
            gotoxy(x,y+8);
            }
       if(num[n][3]) {
            printf(" ---");
            gotoxy(x,y+9);
            }
        else {
            printf("   ");
            gotoxy(x,y+9);
            }
   
}
